package com.ruoyi.quotation.service.impl;


import com.ruoyi.quotation.domain.QuoQuote;
import com.ruoyi.quotation.mapper.QuoQuoteMapper;
import com.ruoyi.quotation.service.QuoQuoteService;
import com.ruoyi.quotation.vo.QuoteEngineeringVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class QuoQuoteServiceImpl implements QuoQuoteService {

    @Autowired
    private QuoQuoteMapper quoQuoteMapper;

    @Override
    public List<QuoQuote> getQuotesByName(String name) {
        return quoQuoteMapper.selectByName(name);
    }

    @Override
    public QuoteEngineeringVO getQuoteWithEngineering(Integer id) {
        return quoQuoteMapper.selectQuoteWithEngineering(id);
    }

    @Override
    public boolean updateQuote(QuoQuote quote) {
        return quoQuoteMapper.updateQuoteById(quote) > 0;
    }

    @Override
    public boolean addQuote(QuoQuote quote) {
        return quoQuoteMapper.insertQuote(quote) > 0;
    }

    @Override
    public boolean deleteQuote(Integer id) {
        return quoQuoteMapper.deleteQuoteByIdAndStatus(id) > 0;
    }
}
